﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GGEditor.API;

namespace GGEditor.API
{
	public class Properties : IPropertiesWriter
	{
		private readonly IDictionary<string, object> settings =
			new Dictionary<string, object>();

		#region Implementation of IProperties

		public void Set(string key, object value)
		{
			settings[key] = value;
		}

		#endregion

		#region Implementation of IPropertiesReader

		public bool GetBool(string key)
		{
			return (bool)settings[key];
		}

		public byte GetByte(string key)
		{
			return (byte)settings[key];
		}

		public char GetChar(string key)
		{
			return (char)settings[key];
		}

		public ushort GetUShort(string key)
		{
			return (ushort)settings[key];
		}

		public short GetShort(string key)
		{
			return (short)settings[key];
		}

		public uint GetUInt(string key)
		{
			return (uint)settings[key];
		}

		public int GetInt(string key)
		{
			return (int)settings[key];
		}

		public ulong GetULong(string key)
		{
			return (ulong)settings[key];
		}

		public long GetLong(string key)
		{
			return (long)settings[key];
		}

		public string GetString(string key)
		{
			return (string)settings[key];
		}

		public float GetFloat(string key)
		{
			return (float)settings[key];
		}

		public double GetDouble(string key)
		{
			return (double)settings[key];
		}

		public bool[] GetBoolArray(string key)
		{
			return (bool[])settings[key];
		}

		public byte[] GetByteArray(string key)
		{
			return (byte[])settings[key];
		}

		public char[] GetCharArray(string key)
		{
			return (char[])settings[key];
		}

		public ushort[] GetUShortArray(string key)
		{
			return (ushort[])settings[key];
		}

		public short[] GetShortArray(string key)
		{
			return (short[])settings[key];
		}

		public uint[] GetUIntArray(string key)
		{
			return (uint[])settings[key];
		}

		public int[] GetIntArray(string key)
		{
			return (int[])settings[key];
		}

		public ulong[] GetULongArray(string key)
		{
			return (ulong[])settings[key];
		}

		public long[] GetLongArray(string key)
		{
			return (long[])settings[key];
		}

		public string[] GetStringArray(string key)
		{
			return (string[])settings[key];
		}

		public float[] GetFloatArray(string key)
		{
			return (float[])settings[key];
		}

		public double[] GetDoubleArray(string key)
		{
			return (double[])settings[key];
		}

		#endregion
	}
}
